Method for image compression and circuit system thereof

ABSTRACT

A method for image compression and a circuit system thereof are provided. In the method, pixel values of an image are obtained. A compression scenario is decided, for example, a uniform-quantization manner or a non-uniform-quantization manner is used for an M-bit image being compressed to an N-bit image so as to decide codeword sections for the image. Every codeword section has a codeword distance. The codeword sections have a fixed codeword distance in the uniform-quantization manner. Alternatively, in the non-uniform-quantization manner, the image can be divided into multiple codeword sections having different codeword distances according to a brightness distribution. Afterwards, a random number is generated for deciding codeword and index for original value of each of the pixels. An index table is accordingly formed. The index table is provided for obtaining the codeword in a decoding process by querying a codebook with the index.

CROSS-REFERENCE TO RELATED PATENT APPLICATION

This application claims the benefit of priority to Taiwan PatentApplication No. 110109896, filed on Mar. 19, 2021. The entire content ofthe above identified application is incorporated herein by reference.

Some references, which may include patents, patent applications andvarious publications, may be cited and discussed in the description ofthis disclosure. The citation and/or discussion of such references isprovided merely to clarify the description of the present disclosure andis not an admission that any such reference is “prior art” to thedisclosure described herein. All references cited and discussed in thisspecification are incorporated herein by reference in their entiretiesand to the same extent as if each reference was individuallyincorporated by reference.

FIELD OF THE DISCLOSURE

The present disclosure is related to a method for image compression, andmore particularly to a method for image compression for a video with afixed-length code based on random and non-uniform quantization and acircuit system thereof.

BACKGROUND OF THE DISCLOSURE

In recent years, with the widespread use of image-taking apparatus, itis easier to acquire image data. Further, the image processingcapability is getting powerful with the hardware upgrades and people canobtain images that have better quality easily. However, a file size ofthe image becomes larger and requires more space to store the image, andsome specific technologies may also increase the requirement of storagespace. For example, multiple images having different exposure ranges canbe combined into a single high-dynamic-range (HDR) image that requiresmore storage space. Further, a three-dimensional noise reduction (3DNR)technology achieves a better effect of noise reduction than asingle-image noise reduction technology since 3DNR is implemented byusing several successive frames of a video, but 3DNR also requires morestorage space. Therefore, for obtaining better quality images, theconventional technologies increase cost of the storage space and loadingfor data transmission and calculation. Therefore, on the premises ofpreventing too much distortion in the process of data compression andkeeping the important information therein, it is an important issue toprovide a more efficient data compression method.

In the conventional method for compressing an image or a video, JPEG(Joint Photographic Experts Group) format is a widespread imagecompression standard. JPEG format uses a variable length coding (VLC)method. VLC is usually a good method for image compression, but it isdifficult to estimate the maximum bandwidth for transmission due to thecharacteristics of a variable length, and uncertainties for designing arelated system are increased. Further, VLC may increase amount of dataunder some extreme cases.

To solve the deficiency of JPEG, conventional image compressiontechnology such as texture compression is provided. The texturecompression can provide a better compression efficiency since it is avector quantization manner that can reduce the size of a codebook madeof code vectors based on a distribution of pixel values of the image,e.g., a color line model. The texture compression is a kind ofnearly-lossless compression, which may compromise the performance ofsome image processing algorithms. For example, when 3DNR averages themultiple compressed images for reducing random noises, 3DNR cannot fixthe distortion due to the image compression, and fails to effectivelymaintain the advantages of 3DNR to keep static texture details, andneeds to overcome error propagation caused by repeated compressions.

Even if distortion is not present in the nearly-lossless compression,the nearly-lossless compression does not apply to the image or videoprocessing process such as 3DNR since the nearly-lossless compressionhas a similar issue with the variable length coding method.

SUMMARY OF THE DISCLOSURE

Even though the conventional methods can achieve effective imagecompression, they still meet the problems such as most of the methodsare kinds of nearly-lossless compression, or due to the variable lengthcoding technology, it is difficult for the conventional methods toestimate the maximum bandwidth for transmission or uncertainties ofsystem design is increased even if the conventional methods can achievenearly-lossless compression. In response to the above-referencedtechnical inadequacies, the present disclosure provides a method forimage compression and a circuit system. The method particularly adopts atechnology for video coding with fixed-length code based on random andnon-uniform quantization that can reduce a negative impact of thecompression process on the image or the video.

In one embodiment of the present disclosure, the method for imagecompression is applied to a circuit system. The circuit system is suchas an image-processing circuit disposed in a camera or a camcorder. Theimage-processing circuit performs the method for image compression. Themethod starts from a step of receiving an image and obtaining pixelvalues of the image via a circuit, in which each of the pixels has anoriginal value.

A compression scenario is firstly decided. The compression scenariodenotes a scenario that utilizes a uniform-quantization manner or anon-uniform-quantization manner to encode the image from M-bit imagedata to N-bit image data, and also decide one or more codeword sections.Each of the codeword sections has a codeword distance. In the method, arandom number generator is used to generate a random number that isreferred to for deciding a codeword and an index of an original value ofeach of the pixels. After the codeword and the index of the originalvalue of the pixel in the method are decided, an index table is formed.The index table records every original value and the correspondingcodeword so as to form a query index for achieving a purpose of queryinga codebook and reproducing the image.

Preferably, in the uniform-quantization manner, since theuniform-quantization manner adopts a fixed codeword distance in everycodeword section, the pixels of the image are divided into multiplesections with the same codeword distance based on configuration of thecodeword section.

In one further embodiment of the disclosure, thenon-uniform-quantization manner is used in image compression based onthe characteristics that a human eye has different sensitivities to abright portion and a dark portion of the image. The image can be dividedinto multiple brightness sections according to a brightness distributionof the image. The multiple brightness sections are assigned withrespective codeword sections according to brightness characteristics ofeach of the brightness sections. The pixels of the image can be dividedinto multiple blocks with different codeword distances according to thecodeword sections.

Further, in the non-uniform-quantization manner, a normal brightnesssection of the image is configured to have a normal codeword distance, alower brightness section of the image is configured to have a smallercodeword distance, and a higher brightness section is configured to havea larger codeword distance.

These and other aspects of the present disclosure will become apparentfrom the following description of the embodiment taken in conjunctionwith the following drawings and their captions, although variations andmodifications therein may be affected without departing from the spiritand scope of the novel concepts of the disclosure.

BRIEF DESCRIPTION OF THE DRAWINGS

The described embodiments may be better understood by reference to thefollowing description and the accompanying drawings, in which:

FIG. 1 is a schematic block diagram depicting a circuit system accordingto one embodiment of the present disclosure;

FIG. 2 is a flow chart describing a method for image compression isimplemented by a uniform-quantization manner according to one embodimentof the present disclosure;

FIG. 3 is another flow chart describing the method for image compressionthat utilizes a non-uniform-quantization manner to decide a codewordaccording to one embodiment of the present disclosure; and

FIG. 4 is a schematic diagram depicting multiple sections havingdifferent brightness within a picture in one embodiment of the presentdisclosure.

DETAILED DESCRIPTION OF THE EXEMPLARY EMBODIMENTS

The present disclosure is more particularly described in the followingexamples that are intended as illustrative only since numerousmodifications and variations therein will be apparent to those skilledin the art. Like numbers in the drawings indicate like componentsthroughout the views. As used in the description herein and throughoutthe claims that follow, unless the context clearly dictates otherwise,the meaning of “a”, “an”, and “the” includes plural reference, and themeaning of “in” includes “in” and “on”. Titles or subtitles can be usedherein for the convenience of a reader, which shall have no influence onthe scope of the present disclosure.

The terms used herein generally have their ordinary meanings in the art.In the case of conflict, the present document, including any definitionsgiven herein, will prevail. The same thing can be expressed in more thanone way. Alternative language and synonyms can be used for any term(s)discussed herein, and no special significance is to be placed uponwhether a term is elaborated or discussed herein. A recital of one ormore synonyms does not exclude the use of other synonyms. The use ofexamples anywhere in this specification including examples of any termsis illustrative only, and in no way limits the scope and meaning of thepresent disclosure or of any exemplified term. Likewise, the presentdisclosure is not limited to various embodiments given herein. Numberingterms such as “first”, “second” or “third” can be used to describevarious components, signals or the like, which are for distinguishingone component/signal from another one only, and are not intended to, norshould be construed to impose any substantive limitations on thecomponents, signals or the like.

The present disclosure provides a method for image compression and acircuit system that implements the method. It is characterized in thatthe method incorporates a fixed-length coding technology for achieving anearly lossless compression with a certain level of compression rate, orachieving the effect of nearly lossless compression under some certainconditions. In other words, after an image is compressed by the methodfor image compression of the present disclosure, human eyes may not beaware of the loss when watching a series of successive frames formed bythe decompressed images.

The characteristics of the method for image compression of the presentdisclosure are described as follows. The method for image compressioncan be applied to a circuit system provided in an electronic device. Theelectronic device is such as a camera, a webcam or a device that iscapable of capturing images or requires image compression. In anexemplary example, the electronic device includes an image-processingchip that is used to perform the method for image compression on animage or a video captured by the electronic device. The method providesan unbiased and nearly lossless compression for the human eyes with aneed of fixed-length code.

Reference is made to FIG. 1 , which is a circuit block diagram depictingmain circuits of the circuit system in an electronic device 10 accordingto one embodiment of the present disclosure.

The circuit system includes an image-processing circuit 101 disposed inthe electronic device 10. The image-processing circuit 101 is such as adigital signal processor (DSP), a microprocessor or a specific kind ofprocessor. The image-processing circuit 101 is generally an integratedcircuit that is capable of image processing. The electronic device 10includes an image-capturing unit 103 that is such as a photo sensor,which can be implemented by a CCD (charge-coupled device) or a CMOS(complementary metal oxide semiconductor). The image-capturing unit 103senses external lights through a lens 109 and forms an image data. Theelectronic device 10 includes a storing unit 105 that implements aflash-based storage device. The storing unit 105 is used to store theimage data processed by the image-capturing unit 103. Theimage-capturing unit 103 is configured to restore or compress an image.The electronic device 10 includes an output interface unit 107 that canconnect with an external host for transmitting the image data to thehost via a wired connection or a wireless connection.

The image-capturing unit 103 receives and senses lights via the lens 109to form the image data. The image data of each of the pixels isretrieved by the image-processing circuit 101. The image data iscompressed by the method for image compression of the presentdisclosure. The method can be implemented by a firmware or softwareexecuted in the circuit system. The image data being compressed andcoded is stored to the storing unit 105. If the electronic device 10 isable to display the image, the image-processing circuit 101 is also incharge of decompressing and restoring the image. The image is thendisplayed by a display unit 111.

FIG. 2 is a flow chart describing the method for image compressionperformed in the image-processing circuit according to one embodiment ofthe present disclosure.

Before performing the method for image compression, a compressionscenario is decided (step S201). The compression scenario includes acompression rate that is applied to an input image. In an exemplaryexample, an M-bit image data can be encoded to an N-bit image dataaccording to the compression rate. The compression scenario allows thesystem to adopt a uniform quantization manner or anon-uniform-quantization manner that takes into consideration a darkportion and a bright portion of the input image, so as to decide theparameters such as a codeword section. The codeword section has acodeword distance. The pixels of the image are divided into multiplesections with the same codeword distance based on a configuration of thecodeword section.

Next, the circuit system receives an image and obtains a pixel value,i.e., an original value x. The image is firstly stored to a storingunit. The pixel value is a gray value, or indicates a combination of ared-channel value, a green-channel value and a blue-channel value in ared-green-blue (RGB) color space. The image received by the circuitsystem can be a series of successive frames that are temporarily storedin a buffer of the circuit system. In the circuit system, anoise-reduction technology such as three-dimensional noise reduction(3DNR) is performed (step S203). According to the compression scenario,i.e., the approach to encode the M-bit image data to the N-bit imagedata, a codeword is generated. Rather than the conventional codewordthat represents the value being encoded from the original value by around-off operation, the method for image compression of the presentdisclosure chooses the codeword randomly based on a random numbergenerated by a random number generator in accordance with thecompression scenario.

In the process, an equation for forming a codeword in a codebook isfirstly decided (step S205). The uniform-quantization manner is utilizedto perform compression coding, and each of the codeword sections adoptsa fixed codeword distance. With encoding the M-bit image data to N-bitimage data as an example, an M-bit codeword (i.e., “c_(i)” inEquation 1) and an N-bit index (i.e., “i” in Equation 1) correspondingto the original value of each of the pixels of the image are decidedaccording to the random number. The codebook (C) is described inEquation 1. The codeword (c) satisfies with a relational expression asdescribed by Equation 2. The numeral “n” is a total number of thecodewords of the N-bit image data. The numeral “i” indicates the indexof the codeword in the N-bit image data, and “i” is ranged from 0 ton−1.C={c _(i)|0≤i<n}, n=2^(N)  (Equation 1)0≤c ₀ < . . . <c _(n−1)<2^(M)  (Equation 2)

Next, with respect to an original value x, a selection procedure for acodeword is performed (step S207) as following procedure, in which “c₀”is the smallest codeword and the codewords of any other pixel valuessmaller than the original value are coded as “c₀”, and “c_(n−1)” is thegreatest codeword and the codewords of any other pixel values greaterthan the original value are coded as “c_(n−1).”

Discriminant (1): the codeword is coded as “c₀” if x<c₀.

Discriminant (2): the codeword is coded as “c_(n−1)” if c_(n−1)<x.

Discriminant (3): if 0<k<n−1, the codeword satisfies an expression“c_(k)≤x<c_(k+1)”, in which the numeral “k” is an index of the imagedata to be processed currently.

At this time, a codeword of the original value x is decided.Specifically, the codeword and an index of the original value x can bedecided according to a random number generated by a random numbergenerator (step S209). The codeword can be decided by the discriminantequations (4) and (5).

Discriminant (4): “c_(k+1)” is chosen with a probability of

${``\frac{x - c_{k}}{c_{k + 1} - c_{k}}"}.$

Discriminant (5): “c_(k)” is chosen with a probability of

${``\frac{c_{k + 1} - x}{c_{k + 1} - c_{k}}"}.$

A random number r is generated by a random number generator. The randomnumber r satisfies a relation of “0≤r<(c_(k+1)−c_(k))”. Thediscriminants for choosing the codewords “c_(k+1)” and “c_(k)” withrespect to the original value x are as follows.

Discriminant (6): “c_(k+1)” is chosen if the random number satisfies arelation of “r<(x−c_(k)).”

Discriminant (7): “c_(k)” is chosen if the random number satisfies arelation of “(x−c_(k))≤r.”

After the codeword “c” and the index (“k+1” or “k”) of the originalvalue in the image are decided, an index table is formed. The indextable is used to query the codebook for obtaining the codeword accordingto the index in a decoding process (step S211). The codebook records aquery index between the original pixel values and codewords. Forreproducing the image, the query index is provided for querying thecodebook conventionally.

With a 8-bit image data being downgraded to a 6-bit image data through acompression process as an example, in an original 8-bit image in an RGBcolor space, each of the pixels of a color image has an R (red) value, aG (green) value and a B (blue) value that are ranged from 0 to 255.Accordingly, an 8-bit pixel is able to reveal 256-level of brightness.

When an 8-bit image data is downgraded, i.e., downgraded through theimage compression process, to a 6-bit image data that is such as asampling process with a base of “4.” The sampling process for decidingthe codewords are such as “0*4, 1*4, . . . 63*4.” In another aspect, an8-bit image data being coded to a 5-bit image data is similar with asampling process with a base of “8.” An original value of the 8-bitimage data (e.g., a frame of a video) is set to “x.” A goal of thecoding process is such as the 6-bit image data, and the original value xsatisfies a relation such as Equation 3. The numerals “c” or “c+1” areused to decide the codewords for the original value x. The numeral “4”can be changed in accordance with the compression scenario. For example,if the 8-bit image data is compressed to a 5-bit image data, the numeralis changed to the base of “8” that is the decimal numeral “2³.”c·4≤x<(c+1)·4  (Equation 3).

The method for image compression of the present disclosure adopts arandom number generator to generate a random number. In an exemplaryexample, the random numbers 0 to 3 can be generated uniformly andrandomly. The codewords corresponding to the original values are “c” or“c+1.” With the 6-bit image data as an example, the numeral “c” isranged from 0 to 63.

Next, in an aspect, the codeword corresponding to the original value xcan be chosen according to the probabilities recited in Equation 4 andEquation 5.

“(c+1)·4” is chosen with a probability of

$\begin{matrix}{{``\frac{x - {c \cdot 4}}{4}"}.} & \left( {{Equation}4} \right)\end{matrix}$

“c·4” is chosen with a probability of

$\begin{matrix}{{``\frac{{\left( {c + 1} \right) \cdot 4} - x}{4}"}.} & \left( {{Equation}5} \right)\end{matrix}$

In view of the above example, with an 8-bit image data downgraded, i.e.,through a compression process, to a 6-bit image data as an example, ifM=8 and N=6, the codeword can be expressed by “c_(i)=i·4.” The numeral“i” is an index that satisfies a relation “0≤i<n and n=2^(N)=64.” Withan original value x=65 as an example, a relation for deciding thecodeword is “64=c₁₆≤x<c₁₇=68.” Therefore, the codeword of the originalvalue x can be chosen as “c₁₆” or “c₁₇.” A random number is generated bya uniform random number generator, and a relation is “0≤r<c₁₇−c₁₆=4.” Arelation can be expressed by “x−c₁₆=65−64=1” if the random number is“r=1.” In the meantime, a relation is “x−c₁₆≤r” and the codeword is“c₁₇.”

The above-mentioned method for image compression adopts a uniformquantization to decide the codeword. Further, if considering a conditionthat the human eyes are more sensitive to the dark portion of the imagebut less sensitive to the bright portion of the image, the non-uniformquantization can be used for deciding the codewords with respect to thebrightness sections according to a bright-dark distribution of theimage. In one embodiment of the method for image compression, in theimage compression process, the pixel values with the original value x ofthe image can be divided into several brightness sections, and each ofthe brightness sections has different codeword differences. Thenon-uniform-quantization manner is then performed based on thedifference between the sensitivities of the human eyes with respect tothe dark portion and the bright portion. It should be noted that thebright portion of the image has a higher original pixel value, and thedark portion of the image has a lower original pixel value.

The non-uniform-quantization manner is used to divide the image into twoor more brightness sections according to a brightness distribution ofthe pixels in the image. The two or more brightness sections areassigned to respective codeword sections according to brightnesscharacteristics of each of the brightness sections. Thus, the pixels ofthe image are divided into multiple blocks with different codeworddistances according to the two or more codeword sections.

Reference is made to FIG. 3 , which is a flow chart describing themethod for image compression with codewords that are decided by thenon-uniform-quantization manner according to one embodiment of thepresent disclosure.

Reference is also made to FIG. 4 , which is a schematic diagramdepicting that an image 40 (e.g., one of a series of successive frames)can be divided into several brightness sections based on a brightnessdistribution. The brightness sections of the image 40 can be classifiedinto a higher brightness section 401, a lower brightness section 403 anda normal brightness section 405.

In the process, a compression scenario is confirmed in the beginning,e.g., an 8-bit image is compressed to a 6-bit image or an image havingother formats (step S301). Next, an input image is obtained (step S303).The image-processing circuit then obtains pixel values of the inputimage, and also a bright-dark distribution rendered from the pixelvalues (step S305). Reference is made to FIG. 4 , which schematicallyshows a distribution graph including several brightness sections.Afterwards, the non-uniform-quantization manner decides the codewordsused for image compression. However, some initial procedures can beperformed before the codewords are decided (step S307).

In an initial procedure, a random quantization manner, i.e., thenon-uniform-quantization manner is used due to the uneven bright-darkdistribution. In the non-uniform-quantization manner, multiple codewordsections can be decided according to the information of the image. Thecodeword sections are configured to have different codeword differencesaccording to the brightness characteristics in each codeword section.For example, a section (e.g., the normal brightness section 405) havingnormal brightness is configured to have a normal codeword distance. Adarker section of the image (e.g., the lower brightness section 403 ofFIG. 4 ) is configured to have the smaller codeword distance. A brightersection in the image (e.g., the higher brightness section 401 of FIG. 4) is configured to have the larger codeword distance. Thus, the sectionsare configured to have the different codeword distances based on thebright-dark distribution of the image. It should be noted that theabove-mentioned normal, brighter or darker section and the correspondingcodeword distances can be set without an absolute setting rule and basedon a practical requirement. The section with the smaller codeworddistance (e.g., the darker section) can have a smaller compression rate,i.e., has a better quality, since the human eyes are more sensitive tothe section in the image. On the contrary, the other section with thelarger codeword distance can be provided with a larger compression rate,i.e., poor quality portion, since the human eyes are less sensitive tothe section.

According to the settings in the above-mentioned initial procedure, theimage is divided into multiple sections with different codeworddistances according to the bright-dark distribution with respect to thepixels or sections (e.g., an average brightness in the sections). In onefurther embodiment of the present disclosure, the pixels of the imagecan be resorted according to brightness of each of the pixels, and thenthe sections assigned to the pixels can be determined for facilitatingthe subsequent calculation.

After the initial procedure, the equations, i.e., Equation 1 andEquation 2 in conjunction with the discriminants (1) to (7) for formingthe codewords in the codebook can be affirmed according to the settings(step S309). Similarly, for every codeword section, a random number isused to decide the codeword with respect to the original value of everypixel. In the equations, numeral “c” is the codeword and the numeral “n”is a total number of the codewords in every codeword section. Since “c₀”is the smallest codeword, the original value with the codeword smallerthan the smallest codeword is coded to “c₀.” Since “c_(n−1)” is thelargest codeword, the original value with the codeword larger than thelargest codeword is coded to “c_(n−1).” Numeral “k” is an index of theimage data which is processed currently, and numeral “x” is the originalvalue. A selection procedure for selecting the codeword according to theoriginal value of every pixel is then initiated (step S311). The randomnumber generated is used to decide the codeword and the index of theoriginal value x (step S313). An index table with respect to the imageis established, and the index table is used in a decoding process forobtaining the codewords by querying a codebook according to the indexes(step S315).

After the codewords are chosen, variances among the brightness sectionsof the image or the frames of a video become small when the image or thevideo are processed by the compression process with the random andnon-uniform-quantization manner. A nearly lossless compression processis achieved since an average of the pixel values still equal to x and itmeans that an expectation value of quantization error is “0”.

With an 8-bit image being compressed to a 6-bit image as an example, thepixel value of each of the pixels of the 8-bit image has a range from 0to 255 and the pixel value of each of the pixels of the 6-bit image hasa range from 0 to 63. For example, a section is configured to have anoriginal pixel value x which is between 0 and 63, and a codeworddistance which is set to “2” with a random number from 0 to 1. Thesection is such as the lower brightness section 403 shown in FIG. 4 .Another section is configured to have an original pixel value x which isbetween 64 and 127, and a codeword distance which is set to “4” with arandom number from 0 to 3. The another section is such as the normalbrightness section 405 shown in FIG. 4 . One further section isconfigured to have an original pixel value x which is between 128 and255, and a codeword distance which is set to “8” with a random numberfrom 0 to 7. The one further section is such as the higher brightnesssection 401 of FIG. 4 .

If the original pixel value x is between 0 and 63 and can be expressedby “c·2≤x<(c+1)·2”, the codeword can be chosen based on theprobabilities recited in Equation 6 and Equation 7.

“(c+1)·2” is chosen with a probability of

$\begin{matrix}{{``\frac{x - {c \cdot 2}}{2}"}.} & \left( {{Equation}6} \right)\end{matrix}$

“c·2” is chosen with a probability of

$\begin{matrix}{{``\frac{{\left( {c + 1} \right) \cdot 2} - x}{2}"}.} & \left( {{Equation}7} \right)\end{matrix}$

If the original pixel value x is between 64 and 127 and can be expressedby “c·4≤x<(c+1)·4”, the codeword can be chosen based on theprobabilities recited in Equation 8 and Equation 9.

“(c+1)·4” is chosen with a probability of

$\begin{matrix}{{``\frac{x - {c \cdot 4}}{4}"}.} & \left( {{Equation}8} \right)\end{matrix}$

“c·4” is chosen with a probability of

$\begin{matrix}{{``\frac{{\left( {c + 1} \right) \cdot 4} - x}{4}"}.} & \left( {{Equation}9} \right)\end{matrix}$

If the original pixel value x is between 128 and 255 and can beexpressed by “c·8≤x<(c+1)·8”, the codeword can be chosen based on theprobabilities recited in Equation 10 and Equation 11.

“(c+1)·8” is chosen with a probability of

$\begin{matrix}{{``\frac{x - {c \cdot 8}}{8}"}.} & \left( {{Equation}10} \right)\end{matrix}$

“c·8” is chosen with a probability of

$\begin{matrix}{{``\frac{{\left( {c + 1} \right) \cdot 8} - x}{8}"}.} & \left( {{Equation}11} \right)\end{matrix}$

Finally, the codeword and the index with respect to every brightnesssection are obtained and an index table is accordingly formed.

In summation, according to the above embodiments of the method for imagecompression, the method is a fixed-length coding technology performed onan image or a video based on random and non-uniform-quantization manner.The method is advantageous in designing a circuit system with anexplicit reference since the circuit system is able to determine abandwidth for transmission. For example, the method allows amanufacturer to design an image-processing circuit for variousrequirements of different products. Further, the method achieves anunbiased and nearly lossless compression and also reduces the negativeimpact on the image when the image undergoes the compression process.For reducing distortion in the compression process, the method adoptsthe non-uniform-quantization process for it considers the sensitivitiesof human eyes to the bright portion and the dark portion of the image.Therefore, the method is applicable to products that require images oflarger size and higher quality, and high-speed performance when themethod achieves nearly lossless compression with an increasing number ofthe successive images. Further, the method provides the nearly losslesscompression with a good compression rate, and the method also meets therequirements of implementing noise reduction, e.g., 3DNR, producinglarge amount of images, and using less storage space.

The foregoing description of the exemplary embodiments of the disclosurehas been presented only for the purposes of illustration and descriptionand is not intended to be exhaustive or to limit the disclosure to theprecise forms disclosed. Many modifications and variations are possiblein light of the above teaching.

The embodiments were chosen and described in order to explain theprinciples of the disclosure and their practical application so as toenable others skilled in the art to utilize the disclosure and variousembodiments and with various modifications as are suited to theparticular use contemplated. Alternative embodiments will becomeapparent to those skilled in the art to which the present disclosurepertains without departing from its spirit and scope.

What is claimed is:
 1. A method for image compression, comprising:obtaining pixel values of an image, each of pixels of the image has anoriginal value; deciding a codeword section having a codeword distanceaccording to a compression scenario, wherein the compression scenariodenotes a scenario that utilizes a uniform-quantization manner or anon-uniform-quantization manner to decode the image from M-bit imagedata to N-bit image data; generating a random number by a random numbergenerator and deciding a range of the random number according to thecodeword section; deciding a codeword and an index of the original valueof each of the pixels according to the random number; and forming anindex table after the codeword and the index of the original value ofeach of the pixels is decided, wherein the index table records a queryindex with respect to the original value of each of the pixels and thecorresponding codeword for achieving a purpose of querying a codebookand reproducing the image; wherein the uniform-quantization manneradopts a fixed codeword distance in every codeword section, and thepixels of the image are divided into multiple sections with the samecodeword distance based on configuration of the codeword section; and,in the non-uniform-quantization manner, the image is divided intomultiple brightness sections according to a brightness distribution ofthe pixels of the image; wherein each of the brightness sections isconfigured to have a respective codeword section according to brightnesscharacteristics of the brightness section, and the pixels of the imageare divided into multiple blocks with different codeword distances basedon the respective codeword sections.
 2. The method according to claim 1,wherein the codebook (C) is described by “C={c_(i)|0≤i<n}, and n=2^(N)”,wherein numeral “c” is the codeword and satisfies an expression “0≤c₀< .. . <c_(n−1)<2^(M)”; numeral “n” is a total number of the codewords ofN-bit image data; numeral “i” is the index of each of the codewords ofthe N-Bit image data and has a range from 0 to n−1; “c₀” is the smallestcodeword and the codewords of any other pixel values smaller than theoriginal value are coded as “c₀”, and “c_(n−1)” is the greatest codewordand the codewords of any other pixel values greater than the originalvalue are coded as “c_(n−1).”
 3. The method according to claim 2,wherein the step for deciding the codeword of the original value of eachof the pixels according to the random number includes discriminantexpressions as follows, in which numeral “k” is the index of the imagedata to be processed currently and numeral “x” is the original value:the codeword is coded as “c₀” if x<c₀; the codeword is coded as“c_(n−1)” if c_(n−1)<x; wherein, if 0≤k<n−1, c_(k)<x<c_(k+1) issatisfied, the codeword of the original value x is decided according toa random number r generated by the random number generator, wherein:“c_(k+1)” is selected with a probability of${``\frac{x - c_{k}}{c_{k + 1} - c_{k}}"};$  and “c_(k)” is selectedwith a probability of ${``\frac{c_{k + 1} - x}{c_{k + 1} - c_{k}}"};$wherein the random number r generated by the random number generatorsatisfies 0≤r<(c_(k+1)−c_(k)), and a discriminant expression forselecting the codeword “c_(k+1)” or “c_(k)” with respect to the originalvalue x is as follows: “c_(k+1)” is selected if r<(x−c_(k)); and “c_(k)”is selected if (x−c_(k))≤r.
 4. The method according to claim 1, wherein,in the non-uniform-quantization manner, a normal brightness section ofthe image is configured to have a normal codeword distance, a lowerbrightness section of the image is configured to have a smaller codeworddistance, and a higher brightness section is configured to have a largercodeword distance.
 5. The method according to claim 4, wherein, withrespect to each of the codeword sections, the step for deciding thecodeword of the original value of each of the pixels according to therandom number includes following discriminant expressions, whereinnumeral “c” is the codeword, numeral “n” is a total number of thecodewords in the codeword section, “c₀” is the smallest codeword and thecodewords of any other pixel values smaller than the original value arecoded as “c₀”, and “c_(n−1)” is the greatest codeword and the codewordsof any other pixel values greater than the original value are coded as“c_(n−1)”, numeral “k” is the index of the image data to be processedcurrently, and numeral “x” is the original value: the codeword is codedas “c₀” if x<c₀; the codeword is coded as “c_(n−1)” if c_(n−1)<xwherein, if 0≤k<n−1, c_(k)≤x<c_(k+1) is satisfied, the codeword of theoriginal value x is decided according to a random number r generated bythe random number generator, wherein: “c_(k+1)” is selected with aprobability of ${``\frac{x - c_{k}}{c_{k + 1} - c_{k}}"};$  and “c_(k)”is selected with a probability of${``\frac{c_{k + 1} - x}{c_{k + 1} - c_{k}}"};$ wherein the randomnumber r generated by the random number generator satisfies0≤r<(c_(k+1)−c_(k)), and a discriminant expression for selecting thecodeword “c_(k+1)” or “c_(k)” with respect to the original value x is asfollows: “c_(k+1)” is selected if r<(x−c_(k)); and “c_(k)” is selectedif (x−c_(k))≤r.
 6. The method according to claim 1, wherein the pixelvalue is a gray value, or indicates a combination of a red-channelvalue, a green-channel value and a blue-channel value in ared-green-blue color space.
 7. A circuit system, comprising: animage-processing circuit disposed in an electronic device for performinga method for image compression, the method comprising: receiving animage and obtaining pixel values of the image, wherein each of pixels ofthe image has an original value, and the pixel values of the image arestored in a storage unit; deciding a codeword section having a codeworddistance according to a compression scenario, wherein the compressionscenario denotes a scenario that utilizes a uniform-quantization manneror a non-uniform-quantization manner to decode the image from M-bitimage data to N-bit image data; generating a random number by a randomnumber generator and deciding a range of the random number according tothe codeword section; deciding a codeword and an index of the originalvalue of each of the pixels according to the random number; and formingan index table after the codeword and the index of the original value ofeach of the pixels is decided, wherein the index table records a queryindex with respect to the original value of each of the pixels and thecorresponding codeword for achieving a purpose of querying a codebookand reproducing the image; wherein the uniform-quantization manneradopts a fixed codeword distance in every codeword section, and thepixels of the image are divided into multiple sections with the samecodeword distance based on configuration of the codeword section; and,in the non-uniform-quantization manner, the image is divided intomultiple brightness sections according to a brightness distribution ofthe pixels of the image; wherein each of the brightness sections isconfigured to have a respective codeword section according to brightnesscharacteristics of the brightness section, and the pixels of the imageare divided into multiple blocks with different codeword distances basedon the respective codeword sections.
 8. The circuit system according toclaim 7, wherein the codebook (C) is described by “C={c_(i)|0≤i<n}, andn=2^(N)”, wherein numeral “c” is the codeword and satisfies anexpression “0≤c₀< . . . <c_(n−1)<2^(M)”; numeral “n” is a total numberof the codewords of N-bit image data; numeral “i” is the index of eachof the codewords of the N-Bit image data and has a range from 0 to n−1;“c₀” is the smallest codeword and the codewords of any other pixelvalues smaller than the original value are coded as “c₀”, and “c_(n−1)”is the greatest codeword and the codewords of any other pixel valuesgreater than the original value are coded as “c_(n−1).”
 9. The circuitsystem according to claim 8, wherein the step for deciding the codewordof the original value of each of the pixels according to the randomnumber includes discriminant expressions as follows, in which numeral“k” is the index of the image data to be processed currently and numeral“x” is the original value: the codeword is coded as “c₀” if x<c₀; thecodeword is coded as “c_(n−1)” if c_(n−1)<x wherein, if 0≤k<n−1,c_(k)≤x<c_(k+1) is satisfied, the codeword of the original value x isdecided according to a random number r generated by the random numbergenerator, wherein: “c_(k+1)” is selected with a probability of${``\frac{x - c_{k}}{c_{k + 1} - c_{k}}"};$  and “c_(k)” is selectedwith a probability of ${``\frac{c_{k + 1} - x}{c_{k + 1} - c_{k}}"};$wherein the random number r generated by the random number generatorsatisfies 0≤r<(c_(k+1)−c_(k)), and a discriminant expression forselecting the codeword “c_(k+1)” or “c_(k)” with respect to the originalvalue x is as follows: “c_(k+1)” is selected if r<(x−c_(k)); and “c_(k)”is selected if (x−c_(k))≤r.
 10. The circuit system according to claim 7,wherein, in the non-uniform-quantization manner, a normal brightnesssection of the image is configured to have a normal codeword distance, alower brightness section of the image is configured to have a smallercodeword distance, and a higher brightness section is configured to havea larger codeword distance.
 11. The circuit system according to claim10, wherein, with respect to each of the codeword sections, the step fordeciding the codeword of the original value of each of the pixelsaccording to the random number includes following discriminantexpressions, wherein numeral “c” is the codeword, numeral “n” is a totalnumber of the codewords in the codeword section, “c₀” is the smallestcodeword and the codewords of any other pixel values smaller than theoriginal value are coded as “c₀”, and “c_(n−1)” is the greatest codewordand the codewords of any other pixel values greater than the originalvalue are coded as “c_(n−1)”, numeral “k” is the index of the image datato be processed currently, and numeral “x” is the original value: thecodeword is coded as “c₀” if x<c₀; the codeword is coded as “c_(n−1)” ifc_(n−1)<x wherein, if 0≤k<n−1, c_(k)≤x<c_(k+1) is satisfied, thecodeword of the original value x is decided according to a random numberr generated by the random number generator, wherein: “c_(k+1)” isselected with a probability of${``\frac{x - c_{k}}{c_{k + 1} - c_{k}}"};$  and “c_(k)” is selectedwith a probability of ${``\frac{c_{k + 1} - x}{c_{k + 1} - c_{k}}"};$wherein the random number r generated by the random number generatorsatisfies 0≤r<(c_(k+1)−c_(k)), and a discriminant expression forselecting the codeword “c_(k+1)” or “c_(k)” with respect to the originalvalue x is as follows: “c_(k+1)” is selected if r<(x−c_(k)); and “c_(k)”is selected if (x−c_(k))≤r.
 12. The circuit system according to claim 7,wherein the pixel value is a gray value, or indicates a combination of ared-channel value, a green-channel value and a blue-channel value in ared-green-blue color space.